{extend name="public/base"/}
{block name="body"}
    <header style="position:relative">
        <div class="bg_top"></div>
        <div class="traval-bgi">
            <img width="100%" src="/static/index/images/b7_ban.jpg" alt="">
        </div>
    </header>
    <div>
        <div class="container">
            <div class="row">
                <!-- Nav tabs -->
                <ul role="tablist" class="col-xs-12 col-sm-12 col-md-2 col-lg-2 traval-menu">
                    <li>联系我们</li>
                    <li role="presentation">
                        <a href="#methods" aria-controls="order" role="tab" data-toggle="tab">
                            联系方式
                        </a>
                    </li>
                    <li role="presentation">
                        <a href="#online" aria-controls="order" role="tab" data-toggle="tab">
                            在线留言
                        </a>
                    </li>
                </ul>
                <!-- Tab panes -->
                <div class="col-xs-12 col-sm-12 col-md-10 col-lg-10 tab-content traval-menu-content">
                    <div role="tabpanel" class="tab-pane active" id="methods">
                        <div style="border-bottom: 1px solid #dae0e4;padding-bottom: 5px;" class="contact-content">
                            <span style="font-size: 20px;font-weight: bold;">联系方式</span>
                            <span style="font-size: 20px;color: #d3d2d2;">Contactinformation</span>
                        </div>
                        <div>
                            <div class="row">
                                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                                    <div class="row">
                                        <img class="col-xs-2 col-sm-2 col-md-3 col-lg-3 contact-address-logo"
                                            src="/static/index/images/contect01.jpg" alt="">
                                        <div class="col-xs-10 col-sm-10 col-md-9 col-lg-9" style="padding-left: 0;">
                                            <div class="contact-address-item" style="font-weight: bold;">地址</div>
                                            <div>{$system.address}</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                                    <div class="row">
                                        <img class="col-xs-2 col-sm-2 col-md-3 col-lg-3 contact-address-logo"
                                            src="/static/index/images/contect02.jpg" alt="">
                                        <div class="col-xs-10 col-sm-10 col-md-9 col-lg-9" style="padding-left: 0;">
                                            <div class="contact-address-item" style="font-weight: bold;">电话</div>
                                            <div>{$system.ser_tel}</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                                    <div class="row">
                                        <img class="col-xs-2 col-sm-2 col-md-3 col-lg-3 contact-address-logo"
                                            src="/static/index/images/contect03.jpg" alt="">
                                        <div class="col-xs-10 col-sm-10 col-md-9 col-lg-9" style="padding-left: 0;">
                                            <div class="contact-address-item" style="font-weight: bold;">邮箱</div>
                                            <div>{$system.email}</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div id="container" class="map-img" style="height:360px;"></div>
                            <!-- <img width="100%" class="map-img" src="/static/index/images/map.jpg" alt=""> -->
                        </div>
                    </div>
                    <div role="tabpanel" class="tab-pane" id="online">
                        <div class="container">
                            <div class="row">
                                <div style="border-bottom: 1px solid #dae0e4;padding-bottom: 5px;"
                                    class="contact-content">
                                    <span style="font-size: 20px;font-weight: bold;">在线留言</span>
                                    <span style="font-size: 20px;color: #d3d2d2;">Online Message</span>
                                </div>
                            </div>
                            <div class="row">
                                <div style="color: #999;font-size: 16px;">感谢您的关注，请填写并提交以下内容，我们会与您取得联系！</div>
                            </div>
                            <div class="row">
                                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 cantact-form-item">
                                    <div class="row md-ml-15" style="border:1px solid #e3e3e3;">
                                        <div class="col-xs-4 col-sm-4 col-md-3 col-lg-3"
                                            style="text-align: center;line-height: 34px;color: #999;">您的姓名 : </div>
                                        <input type="text" name="name" 
                                            class="col-xs-8 col-sm-8 col-md-9 col-lg-9 form-control contact-form-control"
                                            style="border: none;display: inline-block;" placeholder="">
                                    </div>
                                </div>
                                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 cantact-form-item">
                                    <div class="row" style="border:1px solid #e3e3e3;">
                                        <div class="col-xs-4 col-sm-4 col-md-3 col-lg-3"
                                            style="text-align: center;line-height: 34px;color: #999;">您的电话 : </div>
                                        <input type="text" name="tel_phone"
                                            class="col-xs-8 col-sm-8 col-md-9 col-lg-9 form-control contact-form-control"
                                            style="border: none;display: inline-block;" placeholder="">
                                    </div>
                                </div>
                                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 cantact-form-item">
                                    <div class="row md-ml-15" style="border:1px solid #e3e3e3;">
                                        <div class="col-xs-4 col-sm-4 col-md-3 col-lg-3"
                                            style="text-align: center;line-height: 34px;color: #999;">联系邮箱 : </div>
                                        <input type="text" name="email"
                                            class="col-xs-8 col-sm-8 col-md-9 col-lg-9 form-control contact-form-control"
                                            style="border: none;display: inline-block;" placeholder="">
                                    </div>
                                </div>
                                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 cantact-form-item">
                                    <div class="row" style="border:1px solid #e3e3e3;">
                                        <div class="col-xs-4 col-sm-4 col-md-3 col-lg-3"
                                            style="text-align: center;line-height: 34px;color: #999;">公司名称 : </div>
                                        <input type="text" name="company"
                                            class="col-xs-8 col-sm-8 col-md-9 col-lg-9 form-control contact-form-control"
                                            style="border: none;display: inline-block;" placeholder="">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <textarea class="form-control cantact-textarea" style="resize: none;" rows="8" placeholder="留言内容" maxlength="140" name="message"></textarea>
                            </div>
                            <div class="row">
                                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 cantact-form-item">
                                    <div class="row" style="border:1px solid #e3e3e3;">
                                        <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3"
                                            style="text-align: center;line-height: 34px;color: #999;">验证码 : </div>
                                        <input type="text"
                                            class="col-xs-6 col-sm-6 col-md-6 col-lg-6 form-control contact-form-vertify yaninput"
                                            style="border: none;display: inline-block;" placeholder="">
                                        <style type="text/css">
                                            canvas{height:100%;position:absolute;}
                                        </style>
                                        <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 yanimg" id="picyzm" style="text-align: center;position:relative;height:34px;"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="btn-group btn-message" >
                                    <div class="btn " id="submit" style="background-color: #116cb2;color: #fff;font-size: 16px;padding: 10px 25px;border-radius: 20px;">提交留言</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=7b4dYc6MzOAz4D9Qx0BjTG2XrSnkt9oS"></script>
    <script src="/static/lib/layer/2.4/layer.js"></script>
    <script src="/static/index/js/gVerify .js"></script>
    <script type="text/javascript">
        var verifyCode = new GVerify({
            id: "picyzm",
            type: "blend"
        });
        var lat_lng=`{$system.lat_lng}`;
        var map = new BMap.Map("container");          // 创建地图实例  
        var point = new BMap.Point(lat_lng.split(",")[1],lat_lng.split(",")[0]);  // 创建点坐标  
        map.centerAndZoom(point, 15);                 // 初始化地图，设置中心点坐标和地图级别
        map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
        var marker = new BMap.Marker(point);        // 创建标注    
        map.addOverlay(marker);
        $("#submit").click(function() {
            var result = verifyCode.validate($(".yaninput").val());
            if(result){
                layer.load(1, {
                  shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
                var name=$("input[name=name]").val();
                var tel_phone=$("input[name=tel_phone]").val();
                var email=$("input[name=email]").val();
                var company=$("input[name=company]").val();
                var message=$("textarea[name=message]").val();
                $.ajax({
                    type: 'POST',
                    url: "{:url('message_add')}",
                    data: {tel_phone:tel_phone,name:name,email:email,company:company,message:message},
                    success: function(resdata){
                        if(resdata.code==200){
                            layer.msg(resdata.msg,{icon:1,time:1000});
                            setTimeout("parent.location.reload()",1000);
                        }else{
                            layer.msg(resdata.msg,{icon:2,time:3000});
                        }
                    },
                    error: function(){
                        layer.msg('数据保存失败',{icon:2,time:3000});
                    }
                })
            }else{
                layer.msg('验证码错误',{icon:2,time:3000});
            }
            
        })
    </script>
{/block}